package edu.xidian.sselab.cloudcourse.domain;

import lombok.Data;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import java.util.List;

import static jdk.nashorn.internal.objects.NativeDate.setDate;

@Data
public class test7_entity {

    String datee; //日期
    String nation; //车系，德系，法系，韩系，日系，美系，自主
    String salenumber; //销售量

    public test7_entity map(Result result) { //将查询hbase的查询结果映射为test7_entity类
        String rowkey = Bytes.toString(result.getRow());
        setDatee(rowkey.split("##")[0]);
        setNation(rowkey.split("##")[1]);
        List<Cell> cellList = result.listCells();
        Cell cell = cellList.get(0);
        String value = Bytes.toString(CellUtil.cloneValue(cell));
        setSalenumber(value);
        return this;
    }
}
